package ylsb.service;


import org.springframework.stereotype.Service;
import ylsb.dao.YltpHaocaiduibiaoMapper;
import ylsb.model.YltpBaofei;
import ylsb.model.YltpBaofeiExample;
import ylsb.model.YltpHaocaiduibiao;
import ylsb.model.YltpHaocaiduibiaoExample;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class YltphaocaiduibiaoService {

    @Resource
    YltpHaocaiduibiaoMapper ddMapper;

    public List<YltpHaocaiduibiao> findHaocaiduibiaolist(String xiangmuId){
        YltpHaocaiduibiaoExample mmExample=new YltpHaocaiduibiaoExample();
        mmExample.createCriteria().andXiangmuidEqualTo(xiangmuId);
        mmExample.setOrderByClause("ordernumber ASC");
        return  ddMapper.selectByExample(mmExample);

    }

    public boolean deleteByxiangmuId(String xiangmuId){
        YltpHaocaiduibiaoExample mmExample=new YltpHaocaiduibiaoExample();
        YltpHaocaiduibiaoExample.Criteria criteria=mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(xiangmuId);
        return  ddMapper.deleteByExample(mmExample)>=0;
    }

    public boolean isexistByxiangmuId(String xiangmuId){
        YltpHaocaiduibiaoExample mmExample=new YltpHaocaiduibiaoExample();
        YltpHaocaiduibiaoExample.Criteria criteria=mmExample.createCriteria();
        criteria.andXiangmuidEqualTo(xiangmuId);
        return  ddMapper.selectByExample(mmExample).size()>0;
    }

    public boolean add(YltpHaocaiduibiao ppYltpHaocaiduibiao){
        return ddMapper.insert(ppYltpHaocaiduibiao)==1;
    }

    public List<Map<String, Object>> findBiaojuelist(String mmxiangmuId, String mmuserId){

        return ddMapper.findBiaojuelist(mmxiangmuId,mmuserId);
    }


}
